﻿using Abp.Domain.Entities;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;

namespace Sunlit.House.Regions
{
    [Table("AbpRegions")]
    public class Region : Entity
    {
        public const int MaxNameLength = 64;
        public const int MaxSpellLength = 64;
        public const int MaxShortSpellLength = 32;

        /// <summary>
        /// 名称
        /// </summary>
        [Required]
        [StringLength(MaxNameLength, ErrorMessage = "最大长度不得超过{1}个字符")]
        public string Name { get; set; }
        /// <summary>
        /// 简拼
        /// </summary>
        [StringLength(MaxSpellLength, ErrorMessage = "最大长度不得超过{1}个字符")]
        public string Spell { get; set; }
        /// <summary>
        /// 简短拼写
        /// </summary>
        [StringLength(MaxShortSpellLength, ErrorMessage = "最大长度不得超过{1}个字符")]
        public string ShortSpell { get; set; }
        /// <summary>
        /// 显示顺序
        /// </summary>
        public int DisplayOrder { get; set; }
        /// <summary>
        /// 父Id
        /// </summary>
        public int? ParentId { get; set; }
        /// <summary>
        /// 层级
        /// </summary>
        public int Layer { get; set; }
        /// <summary>
        /// 热门地区
        /// </summary>
        public bool IsHot { get; set; }
        /// <summary>
        /// 省ID
        /// </summary>
        public int ProvinceId { get; set; }
        /// <summary>
        /// 省名称
        /// </summary>
        [StringLength(MaxNameLength, ErrorMessage = "最大长度不得超过{1}个字符")]
        public string ProvinceName { get; set; }
        /// <summary>
        /// 城市ID
        /// </summary>
        public int CityId { get; set; }
        /// <summary>
        /// 城市名称
        /// </summary>
        [StringLength(MaxNameLength, ErrorMessage = "最大长度不得超过{1}个字符")]
        public string CityName { get; set; }
        [StringLength(256)]
        public string FullName { get; set; }

        public virtual Region ParentRegion { get; set; }
        public virtual ICollection<Region> ChildRegions { get; set; }

    }
}
